package everyday;

/**
 * @author 兴趣使然黄小黄
 * @version 1.0
 * @date 2023/6/26 22:38
 * 2485. 找出中枢整数
 * https://leetcode.cn/problems/find-the-pivot-integer/
 */
public class Solution2485 {

    public int pivotInteger(int n) {
        int sum = n * (n + 1) / 2;
        int ret = (int) Math.sqrt(sum);
        return ret * ret == sum ? ret : -1;
    }
}
